<template>
    <n-button text @click="handle" @dblclick="dbHandle" >
      <TextIcon @dblclick="dbHandle" v-if="aiModalStatus==='show'" icon="bi:send-dash"
                tip="单击隐藏 双击重置"
                :size="size"></TextIcon>
      <TextIcon @dblclick="dbHandle" v-if="aiModalStatus==='hidden'" icon="cil:send"
                tip="单击显示 双击重置" :size="size"></TextIcon>
      <TextIcon v-if="aiModalStatus==='none'" icon="logos:openai" :size="size+62"></TextIcon>

    </n-button>
</template>

<script setup lang="ts">


import {storeToRefs} from "pinia";
import {useAppStore} from "@/store/module/app";
import TextIcon from "@/components/pc/icon/TextIcon.vue";
import {nextTick} from "vue";

/**
 * 首次点击初始化 显示
 * 再次点击销毁 点击关闭按钮销毁
 * 点击缩小按钮 隐藏  再次点击时
 */
const {aiModalStatus,topModalName} = storeToRefs(useAppStore())
defineProps({
  size:{
    type:Number,
    default:28
  }
})
const handle=()=>{
  topModalName.value='ai'
  if(aiModalStatus.value==='none'||aiModalStatus.value==='hidden'){
    aiModalStatus.value='show'
  }else if(aiModalStatus.value==='show')
  {
    aiModalStatus.value='hidden'
  }
}
const dbHandle=()=>{
  aiModalStatus.value='none'
  nextTick(()=>{
    aiModalStatus.value='show'
  })
}



</script>

<style scoped>

</style>